package cn.wolfcode.luowowo.packagetour.template;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Document(indexName="luowowo_packagetourcontent",type="packagetourcontent")
@Getter
@Setter
public class PackageTourContentTemplate implements Serializable {
    public static final String INDEX_NAME = "luowowo_packagetourcontent";
    public static final String TYPE_NAME = "packagetourcontent";
    @Id
    //@Field 每个文档的字段配置（类型、是否分词、是否存储、分词器 ）
    @Field(store=true, index = false,type = FieldType.Long)
    private Long id;

    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String introduceImages; //图文介绍照片
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String schedule; //行程路线
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String traffic; //交通信息
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String expenses; //费用说明
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String purchase; //购买须知


    public List<String> getImgs(){
        ArrayList<String> list = new ArrayList<>();
        if (introduceImages != null && introduceImages.length()>0){
            String[] strs = introduceImages.split(",");
            for (String s : strs) {
                list.add(s);
            }
        }
        return list;
    }

}
